Hello all,
I have done a bit of search on how to left/center/right justify column headings in proc print but haven't found much... I have found 'Style' and 'Justify' but neither seem to work in my code.
Please let me know if you know how this can be done.
Many thanks
Hi:
I do not see any code where you have actually TRIED style= with justification overrides. Can you try a report using SASHELP.CLASS and see whether your STYLE override works? For example, the code below justifies correctly (and changes colors correctly) for me. I made the report wide so you could REALLY see the impact of the justification.
cynthia
ods _all_ close;
ods html file='c:\temp\print_just.html' style=sasweb;
proc print data=sashelp.class(obs=3)
style(header)={just=c foreground=black}
style(table)={width=100%};
title 'Make the report very wide to see justification';
var name / style(data)={just=r}
style(header)={background=pink};
var age / style(data)={just=l};
var sex height / style(data)={just=c}
style(header)={background=yellow};
var weight / style(data)={just=l};
run;
ods html close;
What code?
It's a simple proc print outputing to HTML.... it looks something like this:
ods html file="**********";
proc print data= **********%scan(&FEDs.,&i.)_c9 (drop=NEW_ED_Code OLD_ED_Code) split="*" noobs;
Title1 "&&FEDPr&i.";
Footnote1 "**********";
label **********;
format **********.;
run;
ods html close;
Thanks
Hi:
I do not see any code where you have actually TRIED style= with justification overrides. Can you try a report using SASHELP.CLASS and see whether your STYLE override works? For example, the code below justifies correctly (and changes colors correctly) for me. I made the report wide so you could REALLY see the impact of the justification.
cynthia
ods _all_ close;
ods html file='c:\temp\print_just.html' style=sasweb;
proc print data=sashelp.class(obs=3)
style(header)={just=c foreground=black}
style(table)={width=100%};
title 'Make the report very wide to see justification';
var name / style(data)={just=r}
style(header)={background=pink};
var age / style(data)={just=l};
var sex height / style(data)={just=c}
style(header)={background=yellow};
var weight / style(data)={just=l};
run;
ods html close;
Thank you, my code works now!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.